#!/usr/bin/env php
<?php
/**
 * 命令行执行应用
 */

use Symfony\Component\Console\Application;

require_once __DIR__ . '/vendor/autoload.php';


// 定义应用目录
define('APP_PATH', __DIR__ . '/app/');

// 注册自动加载
think\Loader::register();

// 注册错误和异常处理机制
think\Error::register();

// 设置默认时区
if ($timezone = C('DEFAULT_TIMEZONE_SET')) {
    date_default_timezone_set($timezone);
}

$application = new Application();

$commanderList = [];
foreach (C('command') as $commander) {
    $commanderList[] = new $commander();
}
if (!empty($commanderList)) {
    $application->addCommands($commanderList);
}

$application->run();
